<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
	</head>
	<body>
	<div class="am-g">
		 {include file='../Common/hy_header.html'}
		 <div class="am-g">
			<br>
			
			<div class="am-u-md-8 am-u-end">
				<form class="am-form am-form-horizontal hy-js-form">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">抽奖名称</label>
						<div class="am-u-sm-6">
							<input type="text" name="title" value="{$info.title}" placeholder="最多16个字">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">抽奖描述</label>
						<div class="am-u-sm-6">
							<input type="text" name="descShow" value="{$info.descShow}" placeholder="最多16个字">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">抽奖开关</label>
						<div class="am-u-sm-6" style="float: left;">
								<input type="radio" value="1" {if $info.onoff eq 1}checked="checked"{/if} name='onoff'> 开启
								<input type="radio" value="0" {if $info.onoff eq 0}checked="checked"{/if} name="onoff"> 关闭
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">抽奖开始时间</label>
						<div class="am-u-sm-6">
							<input type="text" id="begin_time" name="begin_time" value="{$info.begin_time|date_format:'Y-m-d H:i:s'}" placeholder="默认当前时间">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">抽奖失效时间</label>
						<div class="am-u-sm-6">
							<input type="text" id="expire_time" name="expire_time" value="{$info.expire_time|date_format:'Y-m-d H:i:s'}" placeholder="默认当前时间后三天">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					
					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<input type="hidden" name="id" value="{$info.id}">
							<button type="button" class="am-btn am-btn-primary hy-js-submit">保存抽奖红包信息</button>
						</div>
					</div>
					
				</form>
			</div>
		</div>
	</div>
	  {include file='../Common/hy_footer.html'}
	<script type="text/javascript" src="{$_C.hy_path}js/editor/kindeditor.js"></script>
	<script type="text/javascript" src="{$_C.hy_path}js/laydate/laydate.js"></script>
	<script type="text/javascript">
		$(function(){
			laydate({
			   elem: '#begin_time',
			   istime:true,
			   format: 'YYYY-MM-DD hh:mm:ss',
			});
			laydate({
			   elem: '#expire_time',
			   istime:true,
			   format: 'YYYY-MM-DD hh:mm:ss',
			})
		})
	    hy_submit('index.php?g=admin&m=chat&a=edit_luckyDraw','',function(result){
			if(result.error==1){
				showMsg(result.content,result.error);
			}else{
				showMsg(result.content);
				parent.$('#luckyDraw').attr('src', parent.$('#luckyDraw').attr('src'));
				var tab_li = parent.$(".am-active");
				if(tab_li.prev().length>0)
				{
					tab_li.prev().addClass('am-active');
					var id=tab_li.prev().attr('data-id');
			        parent.$('#'+id).show();
				}
				else if(tab_li.next().length>0)
				{
					tab_li.next().addClass('am-active');
					var id=tab_li.next().attr('data-id');
					console.info("next:"+id);
			        parent.$('#'+id).show();
				}
				else
				{
					var tab='<li data-id="index" class="am-active"><a  href="javascript:;"><span class="hy-tabs-title">首页</span><span class="am-icon-close"></span></a></li>'
				    parent.$('.hy-tabs .am-nav').append(tab);
				    var iframe='<iframe onload="javascript:hy_loading()" id="index" src="index.php?g=admin&m=index&a=main" width="100%" height="100%"></iframe>';
				    parent.$('.hy-iframe').append(iframe);
				}
				var id=tab_li.attr('data-id');
				tab_li.remove();
				parent.$('#'+id).remove();
				}
			
			
			
		});
	</script>
	</body>
</html>

